from OPAP.fdtd import *
from scipy import array


if __name__ == "__main__": 
    dxyz = [.2, .2]
    calcTime = 0.5
    roomSize = 2.0, 2.0
    sourcePos = 0.5, 0.4
    
    #IRPos1 = 1.5, 0.5
    IRPos2 = 0.5, 1.75
    
    nodes = array([[1,1],[2,1],[2,2],[1,2]])
    #nodes = array([[0,0]])
    index = Index()
    room = Room(roomSize)
    
    fdtd = FDTD(room, dxyz)
    fdtd.setSource("gaus", sourcePos)
    fdtd.chkCalcField(nodes, index)
    
    ir1 = IR(fdtd, IRPos1)
    irList = [ir1]
    recorder = IRRecorder(fdtd, irList)
    
    index.plot()
    fdtd.looper(index, recorder, calcTime)
    
    figure()
    plot(ir1._record)
    show()
